Creates a shallow clone of the instance
Syntax
Example
BPlusTree/BPlusTree.Test/TestTransactionLog.cs
C# | Copy Code |
---|
using (TempFile temp = new TempFile())
{
temp.Delete();
var opt = new TransactionLogOptions<int, string>(temp.TempPath,
PrimitiveSerializer.Int32,
PrimitiveSerializer.String);
//FileName
Assert.AreEqual(temp.TempPath, opt.FileName);
//Key/Value serializers
Assert.IsTrue(ReferenceEquals(opt.KeySerializer, PrimitiveSerializer.Int32));
Assert.IsTrue(ReferenceEquals(opt.ValueSerializer, PrimitiveSerializer.String));
//FileOptions
Assert.AreEqual(FileOptions.WriteThrough, opt.FileOptions);
Assert.AreEqual(FileOptions.WriteThrough | FileOptions.Asynchronous, opt.FileOptions |= FileOptions.Asynchronous);
//Read Only
Assert.AreEqual(false, opt.ReadOnly);
Assert.AreEqual(true, opt.ReadOnly = true);
//File Buffer
Assert.AreEqual(8, opt.FileBuffer);
Assert.AreEqual(0x40000, opt.FileBuffer = 0x40000);
//Clone
Assert.IsFalse(ReferenceEquals(opt, opt.Clone()));
using(TransactionLog<int, string> log = new TransactionLog<int,string>(opt))
Assert.AreEqual(0, log.Size);
} |
VB.NET | Copy Code |
---|
Using temp As New TempFile()
temp.Delete()
Dim opt As var = New TransactionLogOptions(Of Integer, String)(temp.TempPath, PrimitiveSerializer.Int32, PrimitiveSerializer.[String])
'FileName
Assert.AreEqual(temp.TempPath, opt.FileName)
'Key/Value serializers
Assert.IsTrue(ReferenceEquals(opt.KeySerializer, PrimitiveSerializer.Int32))
Assert.IsTrue(ReferenceEquals(opt.ValueSerializer, PrimitiveSerializer.[String]))
'FileOptions
Assert.AreEqual(FileOptions.WriteThrough, opt.FileOptions)
Assert.AreEqual(FileOptions.WriteThrough Or FileOptions.Asynchronous, opt.FileOptions = opt.FileOptions Or FileOptions.Asynchronous)
'Read Only
Assert.AreEqual(False, opt.[ReadOnly])
Assert.AreEqual(True, opt.[ReadOnly] = True)
'File Buffer
Assert.AreEqual(8, opt.FileBuffer)
Assert.AreEqual(&H40000, opt.FileBuffer = &H40000)
'Clone
Assert.IsFalse(ReferenceEquals(opt, opt.Clone()))
Using log As New TransactionLog(Of Integer, String)(opt)
Assert.AreEqual(0, log.Size)
End Using
End Using |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also